#include<stdio.h>

int main()
{
	int sign=-1,x,dog=1,s,num=1;
	scanf("%d",&x);
	while(1)
	{
		s=dog/x;
		if(s!=0) sign=1;
		
		if(sign==1)
		{
			printf("%d",s);
		}
		if(dog%x==0) break;
		dog=dog%x*10+1;
		num++; 
	}
	printf(" %d",num);
	return 0;
}
